<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page   contentType="text/html;charset=UTF-8" language="java" %>
<%
	String path = request.getContextPath();
%>
<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<link rel="stylesheet" />
		<link rel="stylesheet" href="<%=path%>/css/Site.css" />
		<link rel="stylesheet" href="<%=path%>/css/zy.all.css" />
		<link rel="stylesheet" href="<%=path%>/css/font-awesome.min.css" />
		<link rel="stylesheet" href="<%=path%>/css/amazeui.min.css" />
		<link rel="stylesheet" href="<%=path%>/css/admin.css" />
		<style>
		.search {
		    padding:10px 0;
		}
		#sform {
		    position:relative;
		    width:600px;
			margin-top: 10px;
			margin-bottom: 30px;
		}
		
		#search {
		    width:100%;
		    height:42px;
		    padding-left:13px;
			border-radius: 5px;
		}
		#btn_search {
		    height:42px;
		    width:80px;
		    cursor:pointer;
		    position:absolute;
		}     
		.bar #btn_search {
		    border:2px solid #4F99C6;
		    border-radius:5px;
		    background:transparent;
		    top:0;
		    right:0;
		}
		.bar #btn_search {
		    background:#4F99C6;
		    border-radius:0 5px 5px 0;
		    width:100px;
		    top:0;
		    right:0;
		}
		.bar #btn_search:before {
		    content:"搜索";
		    font-size:15px;
		    color:#F9F0DA;
		}
		</style>
	<body>
		<div class="dvcontent">

			<div>
				<!--tab start-->
				<div class="tabs">
					<div class="hd">
						<ul style="">
							<li style="box-sizing: initial;-webkit-box-sizing: initial;" class="on">审批</li>
						</ul>
					</div>
					
					<div class="bd">
						<ul style="display: block;padding: 20px;">
							<li>
								<!--分页显示角色信息 start-->
								<div id="dv1">
									<div class="search bar">
                                        <form id="sform" action="<%=path%>/teachering/search">
                                            <input placeholder="输入关键字查询" name="key" type="text" id="search" value="${key}">
                                            <button type="submit" id="btn_search"></button>
                                        </form>
									</div>
									<p style="color:red;size: A3; text-align: center">${message}</p>
									<table class="table" id="tbRecord">
										<form action="<%=path%>/teachering/deleteItems" method="post" id="form1">
										<thead>
											<tr>
												<th><input type="checkbox" id="selectAll"> 全选/反选</th>
												<th>课程编号</th>
												<th>课程名</th>
												<th>时间</th>
												<th>教室</th>
												<th>申请人</th>
												<th>同意</th>
												<th>拒绝</th>
											</tr>
										</thead>
										<c:forEach items="${info.list}" var="teachering">
											<tbody>
											<td><input type="checkbox" name="chkIds" value="${teachering.teacheringId}"></td>
											<td>${teachering.courseId}</td>
											<td>${teachering.course.courseName}</td>
											<td>${teachering.courseTime}</td>
											<td>${teachering.classroom}</td>
											<td>${teachering.teacher.teacherName}</td>
											<td>
												<a href="javascript:agree(${teachering.teacheringId})">
													<span class="glyphicon glyphicon-edit" aria-hidden="true"></i>✔同意</span>
												</a>
											</td>
											<td>
												<a href="javascript:refuse(${teachering.teacheringId})">
													<span class="glyphicon glyphicon-trash del" aria-hidden="true">X拒绝</span>
												</a>
											</td>
											</tbody>
										</c:forEach>

										</form>
									</table>
									<button style="margin-left: 30%;color: white; padding: 4px; background-color:#4F99C6;" onclick="agreeAllApproval()" >✔一键同意</button>
								</div>
								<!--分页显示角色信息 end-->
							</li>
						</ul>
						<ul class="theme-popbod dform" style="display: none;">
							<div class="am-cf admin-main" style="padding-top: 0px;">
		<!-- content end -->
	</div>
							<!-- end-->
						</ul>
					</div>
				</div>
				<!--tab end-->

			</div>

			<script src="<%=path%>/js/jquery-3.6.0.js" type="text/javascript"></script>
			<script src="<%=path%>/js/jquery-1.7.2.min.js" type="text/javascript"></script>
			<script src="<%=path%>/js/plugs/Jqueryplugs.js" type="text/javascript"></script>
			<script src="<%=path%>/js/_layout.js"></script>
			<script src="<%=path%>/js/plugs/jquery.SuperSlide.source.js"></script>
			<!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
			<script src="<%=path%>/js/jquery.min.js"></script>
			<!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
			<script src="<%=path%>/js/bootstrap.min.js"></script>
			<script type="text/javascript" src="<%=path%>/js/alert.min.js"></script>
			<script>
                function agree(teacheringId) {
                    $.confirm('确认要同意该申请吗？', function (isConfirm) {
                        if (isConfirm) {
                            //$.alert('确认');
                            window.location.href ="<%=path%>/teachering/agree?teacheringId="+teacheringId;
                        } else {
                            //$.alert('取消');
                        }
                    });
                }
                function refuse(teacheringId) {
                    $.confirm('确认要拒绝该申请吗？', function (isConfirm) {
                        if (isConfirm) {
                            //$.alert('确认');
                            window.location.href ="<%=path%>/teachering/refuse?teacheringId="+teacheringId;
                        } else {
                            //$.alert('取消');
                        }
                    });
                }
                function agreeAllApproval() {
                    $.confirm('确定要全部同意吗？', function (isConfirm) {
                        if (isConfirm) {
                            document.getElementById("form1").submit();
                        } else {
                            //$.alert('取消');
                        }
                    });
                }

                document.getElementById("selectAll").onclick=function(){
                    var cbs=document.getElementsByName("chkIds");
                    //遍历下面所有的选项
                    for(var i=0;i<cbs.length;i++){
                        //设置cbs[i].checked的状态与第一个firstcb.checked相同
                        cbs[i].checked=this.checked;
                    }
                }
			</script>

		</div>
	</body>

</html>